<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" >
<head>
	<title>管理员后台</title>
	<meta charset="UTF-8"/>
	<link rel="stylesheet" type="text/css" href="/css/mygoodsshelf.css"/>
	<!-- javascript- -->
	<script type="text/javascript" src="/js/jquery-3.2.js"></script>
	<script type="text/javascript" src="/js/infomation.js"></script>
	<script type="text/javascript">
		$(function ()
		{
			$('.sex').click(function ()
			{
				var id = $(this).attr('value');
				window.location.href = '/editThisUser.do?UID=' + id;
			})
		});
	</script>

	<script>
		$(function ()
		{
			$('.name').click(function ()
			{
				var r = confirm("确定删除该用户？")
				if (r === true) {
					var id = $(this).attr('value');
//                    alert(id);
					window.location.href='/deleteThisUser.do?UID='+id;
				}
			});
		})
	</script>

	<script>
		$(function ()
		{
			$('.submit-btn').click(function ()
			{
				var res = $(this).attr("value").split(" ");
				var id = res[0];
				var email = res[1];

				var r = confirm("确定重置此用户密码？")

				if(r === true)
				{
					window.location.href = "/resetPassword.do?UID=" + id;
					alert("已向" + email + "发送密码重置通知邮件");
				}

			});
		});


	</script>

</head>
<body>
<!-- 导航条 -->
<nav class="navbar">
	<div class="nav-menu">
		<ul class="menu">
			<li><a href="/">首页</a></li>
			<li><a href="/goToMallPage.do">二手商品</a></li>
			<!--                <li><a href="request.html">求购区</a></li>-->
		</ul>
	</div><!-- nav-menu -->

	<!--      <form class="nav-search">-->
	<!--        <input type="search" class="searchIn" placeholder="搜二手商品..."/>-->
	<!--        <button class="search-logo"><img src="/image/search.png"/></button>-->
	<!--      </form>-->

	<div class="nav-info">
		<!--			<a class="username" href="information.html">用户</a>-->
		<a href="/personal_info.do" th:text="${marketUser.uname}"></a>
		<!--			<a class="goodsshelf" href="register1.html">||&nbsp;&nbsp;&nbsp;注册</a>-->
		<a class="goodshelf" href="/goToMyCart.do">||&nbsp;&nbsp;&nbsp;我的购物车</a>
		<a class="logout" href="/logout.do">[ 退 出 ]</a>
	</div> <!-- nav-info -->
</nav>


<div align="center">
	<a href="/goToAddUser.do">新增用户</a>
	<table border="1" cellspacing="10px">
<!--		<a>新增用户</a>-->
		<thead>
		<tr>
			<th width="150px">用户ID</th>
			<th width="150px">用户名</th>
			<th width="150px">用户邮箱</th>
			<th width="150px">用户电话</th>
			<th width="150px"></th>
			<th width="150px"></th>
			<th width="150px"></th>
		</tr>
		</thead>
		<tbody>
		<figure th:each="o:${userList}">
			<tr>
				<td th:text="${o.UID}" align="center"></td>
				<td th:text="${o.uname}" align="center"></td>
				<td th:text="${o.email}" align="center"></td>
				<td th:text="${o.phoneNum}" align="center"></td>
				<td align="center"><a class="submit-btn" th:value="${o.UID} + ' ' + ${o.email}">重置密码</a></td>
				<td align="center"><a class="sex" th:value="${o.UID}">编辑</a></td>
				<td align="center"><a class="name" th:value="${o.UID}">删除</a></td>
			</tr>
		</figure>
		</tbody>
	</table>
</div>


<footer>
	<a href="#">©2021-7 二手物品交易</a>
	<a href="#">意见反馈&nbsp;&nbsp;&nbsp;联系我们&nbsp;&nbsp;&nbsp;隐私权声明&nbsp;&nbsp;&nbsp;使用条款</a>
</footer>


</body>
</html>